export default {
	data() {
		return {
			share: {
				title: '建筑装饰知识百科，装饰人的学习社交圈！提升职业技能，共享行业资源！',
				path: '/pages/index',
				imageUrl: '',
			}
		}
	},
	onShareAppMessage(res) {
		this.share.title = '装饰人的学习社交圈！'
		this.share.imageUrl = ''
		this.$request('/api2/wxshare_integral','POST',{}).then(res => {
		
		}).catch(err => {
			console.log(err)
		})
		
		var pages = getCurrentPages() // 获取栈实例
		let currentPage = pages[pages.length - 1]['$page']['fullPath'] //当前页面路径(带参数)
		let shareinfo = pages[pages.length - 1]['$vm']['shareinfo']
		if(shareinfo){
			this.share.imageUrl = shareinfo.img
			this.share.title = shareinfo.title
			currentPage = shareinfo.path
		}
		return {
			title: this.share.title,
			path: currentPage,
			imageUrl: this.share.imageUrl,
		}
	},
	//2.分享到朋友圈
	onShareTimeline(res) {
		this.share.title = '建筑装饰知识百科，装饰人的学习社交圈！提升职业技能，共享行业资源！'
		this.share.imageUrl = 'https://xinzhu-1301398555.cos.ap-shanghai.myqcloud.com/wxapp/share-logo.jpg'
		var pages = getCurrentPages() // 获取栈实例
		let currentPage = pages[pages.length - 1]['$page']['fullPath'] //当前页面路径(带参数)
		
		let shareinfo = pages[pages.length - 1]['$vm']['shareinfo']
		if(shareinfo){
			this.share.imageUrl = shareinfo.img
			this.share.title = shareinfo.title
			currentPage = shareinfo.path
		}
		
		this.$request('/api2/wxshare_integral','POST',{}).then(res => {

		}).catch(err => {
			console.log(err)
		})
		
		return {
			title: this.share.title,
			path: currentPage,
			imageUrl: this.share.imageUrl,
		}
	},
}